<?php if ($gtAccount != NULL){ ?>
<?php

if($replaceHour!=null){
    $replaceEntry = $replaceHour['Hour']['trans_id'];
    $empID = $replaceHour['Hour']['employee_id'];
    $dateTime= $replaceHour['Hour']['date'];
    $selectedClockAction = $replaceHour['Hour']['clock_in'];
    $projectOptions = array();
    foreach($projects as $proj):
        $projectOptions[$proj['Project']['project_id']] =  $proj['Project']['description'];
    endforeach;
}
else{
$employeeOptions = array();
foreach($employeeGroups as $group):
	foreach($group['Employees'] as $employee):
        $employeeOptions[$employee['employee_id']] = $employee['name'];        
    endforeach;
endforeach;

    $projectOptions = array();
    foreach($projects as $proj):
        $projectOptions[$proj['Project']['project_id']] =  $proj['Project']['description'];
    endforeach;
    $selectedClockAction = null;
    $replaceEntry = null;
    $empID = null; 
    $dateTime= null;
}

?>

<?php
    




echo $this->Form->create('Hour');
if($replaceHour!=null){
echo $this->Form->input('employee_id', array(
        'label' => 'Employee ID',
        'type' => 'text',
        'default' => $empID,
        'readonly' => 'readonly'
    ));
}
else{
echo $this->Form->input('employee_id', array(
        'label' => 'Employee ID',
        'type' => 'select',
        'options' => $employeeOptions
    ));

}
echo $this->Form->input('clock_in', array(
        'label' => 'Clock In/Out',
        'type' => 'radio',
        'options' => array('Clock Out', 'Clock In'),
        'default' => $selectedClockAction
    ));

if($replaceHour!=null){
echo $this->Form->input('replaces', array(
        'label' => 'Replaces Entry',
        'type' => 'text',
        'default' => $replaceEntry,
        'readonly' => 'readonly'
    ));
}
else{
echo $this->Form->input('replaces', array(
        'label' => 'Replaces Entry',
        'type' => 'hidden',
        'default' => null,
        'readonly' => 'readonly'
    ));

}

echo $this->Form->input('proj_id',array(
        'label' => 'Project',
        'type' => 'select',
        'options' => $projectOptions
    ));

echo $this->Form->input('datetime',array(
        'label' => 'Datetime',
        'type' => 'text',
        'default' => $dateTime
    ));

echo $this->Form->input('comment',array(
        'label' => 'Comment',
        'type' => 'text'
    ));

echo $this->Form->end('Make Change');
?>
<?php } else{ ?>
<h1> Invalid Login </h1>
<?php }?>
